/* This file is part of the Crimsoon project
  * Copyright (C) 2009 Eduardo Henrique <eduardohleite@gmail.com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
  * License as published by the Free Software Foundation; either
  * version 2 of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Library General Public License for more details.
  *
  * You should have received a copy of the GNU Library General Public License
  * along with this library; see the file COPYING.LIB.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  * Boston, MA 02110-1301, USA.
*/

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui/QMainWindow>
#include <QModelIndex>

class QAction;
class QMenu;
class QLabel;
class QWidget;
class QHBoxLayout;
class QVBoxLayout;
class QSplitter;
class QListWidget;

class GalleryTree;
class GalleryList;
class PlayPanel;
class InfoPanel;
class PlayList;

enum DisplayList
{
    DisplayPlayingList,
    DisplayGallery
};

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

private slots:
    void onFileOpenFileTriggered();
    void onFileOpenDirectoryTriggered();
    void onFileOpenUrlTriggered();
    void onFileSaveAsTriggered();
    void onFilePropertiesTriggered();
    void onFileExitTriggered();
    void onExecuteRepeatTriggered();
    void onExecuteRepeatAllTriggered();
    void onToolsImportMediaTriggered();
    void onToolsUpdateGalleryTriggered();
    void onHelpAboutTriggered();
    void onListClicked(QModelIndex index);
    void onTreeClicked(QModelIndex index);
    void onListDoubleClicked(QModelIndex index);    
    void onPlayFileChanged(QString filename);
    void onPlayPanelStatusChanged();

private:
    void destroyWidgets();
    void createWidgets();
    void createMenus();    
    void createFileMenu();
    void createExecuteMenu();
    void createToolsMenu();
    void createHelpMenu();
    void createActions();
    void createFileMenuActions();
    void createExecuteMenuActions();
    void createToolsMenuActions();
    void createHelpMenuActions();
    void createStatusBar();
    void createCentralWidget();
    void setPlayList();

    QMenu *fileMenu;
    QMenu *executeMenu;
    QMenu *toolsMenu;
    QMenu *helpMenu;
    QAction *fileOpenFileAction;
    QAction *fileOpenDirectoryAction;
    QAction *fileOpenUrlAction;
    QAction *fileSaveAsAction;
    QAction *filePropertiesAction;
    QAction *fileExitAction;
    QAction *executeRepeatAction;
    QAction *executeRepeatAllAction;
    QAction *executeShuffleAction;
    QAction *toolsImportMediaAction;
    QAction *toolsUpdateGalleryAction;
    QAction *helpAboutAction;
    QLabel    *notifyLabel;
    QWidget   *centralWidget;
    QSplitter *splitter;
    QHBoxLayout *mainLayout;
    QVBoxLayout *overallLayout;

    GalleryList *galleryList;
    GalleryTree *galleryTree;
    PlayPanel   *playPanel;
    InfoPanel   *infoPanel;
    PlayList    *playList;

    DisplayList displaying;
    QString     currentFilename;
};

#endif // MAINWINDOW_H
